<!DOCTYPE html>
<html lang="zh-cn">
<#include "include/resource-head.ftl"/>
<body>
<#include "include/common-header.ftl"/>
<div class="container col-center-block">
    <div><img src="/data/imgs/login-banner.jpg"></div>

    <div class="row-fluid clearfix">
        <div class="col-md-6 pull-left">
            <div class="text-center"><h3 >注册</h3></div>
            <form class="form-horizontal col-md-6 col-center-block" action="/register" method="post" onsubmit="return register_submit()">
                <input type="hidden" name="type" value="0">
                <div class="input-group">
                    <span class="input-group-addon">手机号</span>
                    <input type="text" name="phone" class="form-control" placeholder="手机号" id="reg-phone">
                </div><br/>
                <div class="input-group">
                    <span class="input-group-addon">用户名</span>
                    <input type="text" class="form-control" name="username" placeholder="用户名" id="reg-username">
                </div><br/>
                <div class="input-group">
                    <span class="input-group-addon">密&nbsp;&nbsp;&nbsp;&nbsp;码</span>
                    <input type="password" class="form-control" name="password" placeholder="密码" id="reg-password">
                </div>
                <br/>
                <div class="input-group ">
                    <input type="submit" class="btn btn-primary " value="注册">
                </div>
            </form>
        </div>
        <div class="col-md-1 pull-left" style="border-left: 1px dotted #e6e6e6; height: 235px;margin-top: 20px">&nbsp;</div>
        <div class="col-md-5 pull-left">
            <div class="text-center"><h3 >登录</h3></div>
            <form class="form-horizontal col-md-8 col-center-block" action="/login" method="post" onsubmit="return login_submit()">
                <div class="input-group">
                    <span class="input-group-addon">手机号</span>
                    <input type="text" class="form-control" placeholder="手机号" name="phone" id="log-phone">
                </div><br/>
                <div class="input-group">
                    <span class="input-group-addon">密&nbsp;&nbsp;&nbsp;&nbsp;码</span>
                    <input type="password" class="form-control" NAME="password" placeholder="密码" id="log-password">
                </div>
                <br/>
                <div class="input-group ">
                    <input type="submit" class="btn btn-success " value="登录">
                </div>
            </form>
        </div>
    </div>
</div>
<#include "include/common-foot.ftl"/>
</body>
<#include "include/resource-script.ftl"/>
<script>
    var phoneReg =/^1[3|4|7|5|8][0-9]{9}$/;
    function register_submit() {
        var phone = $("#reg-phone").val();
        var username = $("#reg-username").val();
        var password = $("#reg-password").val();
        if(!phoneReg.test(phone)){
            alert("手机号格式不对");
            return false;
        }
        if(username.length == 0){
            alert("请输入用户名");
            return false;
        }
        if(password.length == 0){
            alert("请输入密码");
            return false;
        }
        return true;
    }

    function login_submit() {
        var phone = $("#log-phone").val();
        var password = $("#log-password").val();
        if(!phoneReg.test(phone)){
            alert("手机号格式不对");
            return false;
        }
        if(password.length == 0){
            alert("请输入密码");
            return false;
        }
        return true;
    }
</script>
</html>